www.gusucode.com > 环保时代家庭财务管理系统 EPffms v4.0 > 环保时代家庭财务管理系统 EPffms v4.0\code\eptimehome\diary\add.asp

    <!-- #include file="../conn.asp" -->
<!--#include file="getip.asp"-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<META http-equiv="Pragma" content="no-cache">
<META http-equiv="Cache-Control" content="no-cache, must-revalidate">
<META http-equiv="Expires" content="0">
<head>
<title></title>
<link href="../images/base.css" rel="stylesheet" type="text/css" />
<script language="javascript">

function   test()    //按cter+enter发表留言
  {   
          if(window.event.keyCode==13&&window.event.ctrlKey)   
          {   
				  document.form1.submit();   
          }   
  } 
  
function check()
{
  if (document.form1.title.value == "")
  {
     alert('标题不允许为空!');
	 return false;
  }
  else if (document.form1.content.value == "")
  {
      alert ('内容不允许为空!');
	  return false;
  }
}  
</script>
</head>
<%
If Request.QueryString("act") = "save" Then
  Dim EP_ok
  If Cint(Request.Form("EP_ok")) = 1 Then
    EP_ok = 1
  Else
    EP_ok = 0	
  End If 
  Conn.Execute ("Insert into eptime_diary (ep_title,ep_content,ep_addtime,ep_ip,ep_ok,ep_date,ep_author) values ('"& server.HTMLEncode(request.Form("title")) &"','"&  server.HTMLEncode(request.Form("content")) &"','"& now() &"','"& ip &"',"& EP_ok &",'"&  server.HTMLEncode(request.Form("date")) &"','"&request.Cookies("UserID")&"')")
 Response.Write("<script>alert('发表成功!');location.href='diary.asp?act=showlist'</script>")
End If

If Request.QueryString("act") = "edit" Then

If Request.QueryString("id")<>"" Then

Conn.Execute "update eptime_diary set ep_title='"&server.HTMLEncode(request.Form("title"))&"',ep_content='"&server.HTMLEncode(request.Form("content"))&"',ep_ok='"&Cint(Request.Form("EP_ok"))&"',ep_date='"&server.HTMLEncode(request.Form("date"))&"' where ep_id="&request("id")

Response.Write("<script>alert('修改成功!');location.href='diary.asp?act=showlist'</script>")
Else
Response.Write("<script>alert('参数错误!');location.href='diary.asp?act=showlist'</script>")
End If


End If


%>
<%If Request.QueryString("id")<>"" Then
set rs = server.CreateObject("adodb.recordset")    
rs.open "select * from Eptime_diary where ep_id="& request.QueryString("id"),conn,1,1
%>
<body onkeydown="test();">
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='首页&nbsp;&raquo;&nbsp;理财日记&nbsp;&raquo;&nbsp;修改日记';</script> 
		<table width="750" height="513" align="center" border="0" cellpadding="0" cellspacing="0">
		<form action="?act=edit&id=<%=request.QueryString("id")%>" method="post" name="form1" id="form1" onsubmit="return check();">
		  <tr>
            <td  align="left" style="font-size:14px;color:#009900;">日记标题: <input name="title" value="<%=rs("ep_title")%>" style="font-size:14px;color:#009900;width:300px;" type="text" id="zt" onmouseover="this.focus();" /> 
              </td>
          </tr>
          <tr>
            <td height="25" align="left" class="lx_input_font" style="font-size:14px;color:#009900;">所在日期:
              <input name="date" style="font-size:14px;color:#009900;" type="text" value="<%=rs("ep_Date")%>" readonly  onmouseover="this.focus();"/>
<img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('../day.asp?form=form1&field=date&oldDate='+date.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=150,left=590');"> 
<input value="1" name="EP_ok" type="radio" id="opt1" <%If rs("ep_ok")=1 then%>checked="checked" <%End if%>/><label for="opt1" >本日记公开</label>
    <input value="0" name="EP_ok" type="radio" id="opt2" <%If rs("ep_ok")=0 then%>checked="checked" <%End if%>/><label for="opt2" >本日记保密</label>
</td>
          </tr>
          <tr>
            <td height="35" align="center" class="lx_input_font">
    <table width="690" height="408" align="center"  cellpadding="0" cellspacing="0">
      <tr>
        <td height="24" colspan="5"><img src="../images/diary_3.jpg" width="690" height="24" /></td>
      </tr>
      <tr>
        <td width="33" height="327"><img src="../images/diary_5.jpg" width="33" height="327" /></td>
        <td width="293" valign="top" background="../images/diary_12.jpg"><table cellspacing="0" cellpadding="0">
            <tr>
              <td width="293" height="21" valign="bottom" background="../images/diary_6.jpg">&nbsp;</td>
            </tr>
            <tr>
              <td width="293" height="11"><img src="../images/diary_10.jpg" width="293" height="11" alt="" /></td>
            </tr>
            <tr>
              <td width="293" height="292" valign="top" background="../images/diary_12.jpg">

<textarea name="content" id="content"  cols="34" rows="17" class="diary_bg" onkeydown="igEsc();"><%=rs("ep_content")%></textarea>

</td>
            </tr>
        </table></td>
        <td width="30" rowspan="2"><img src="../images/diary_7.jpg" width="30" height="350" /></td>
        <td width="293" bgcolor="#FFFFFF"><div align="center"><img src="<%=diarypic%>" id="pic1" width="260" /></div>
        </td>
        <td width="41"><img src="../images/diary_9.jpg" width="41" height="327" /></td>
      </tr>
      <tr>
        <td height="23" colspan="2" background="../images/diary_14.jpg" style="text-align:center;color:#999;"></td>
        <td colspan="2" background="../images/diary_15.jpg">&nbsp;</td>
      </tr>
      <tr>
        <td height="34" colspan="5"><img src="../images/diary_16.jpg" width="690" height="34" /></td>
      </tr>
    </table>
<input type="submit" style="font-size:14px;color:#009900;" value=" 提 交 修 改" onClick="return check()" class="button"> 按住Ctrl+Enter可以提交
                 </td>
            </tr>
		  </form>
        </table>

<%else%>

<body onkeydown="test();">
<!--当前导航-->
<script type="text/JavaScript">if(parent.$('admincpnav')) parent.$('admincpnav').innerHTML='首页&nbsp;&raquo;&nbsp;理财日记&nbsp;&raquo;&nbsp;写日记';</script>     
		<table width="750" height="513" align="center" border="0" cellpadding="0" cellspacing="0">
		<form action="?act=save" method="post" name="form1" id="form1" onsubmit="return check();">
		  <tr>
            <td  align="left" style="font-size:14px;color:#009900;">日记标题: <input name="title" style="font-size:14px;color:#009900;width:300px;" type="text" id="zt" onmouseover="this.focus();" /> 
              </td>
          </tr>
          <tr>
            <td height="25" align="left" class="lx_input_font" style="font-size:14px;color:#009900;">所在日期:
              <input name="date" style="font-size:14px;color:#009900;" type="text" value="<%=Date()%>" readonly  onmouseover="this.focus();"/>
<img src="../images/date.gif" align="absmiddle" style="cursor:pointer;" onClick="JavaScript:window.open('../day.asp?form=form1&field=date&oldDate='+date.value,'','directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=250,height=170,top=150,left=590');"> 
<input value="1" name="EP_ok" type="radio" id="opt1" checked="checked" /><label for="opt1" >本日记公开</label>
    <input value="0" name="EP_ok" type="radio" id="opt2" /><label for="opt2" >本日记保密</label>
</td>
          </tr>
          <tr>
            <td height="35" align="center" class="lx_input_font">
    <table width="690" height="408" align="center"  cellpadding="0" cellspacing="0">
      <tr>
        <td height="24" colspan="5"><img src="../images/diary_3.jpg" width="690" height="24" /></td>
      </tr>
      <tr>
        <td width="33" height="327"><img src="../images/diary_5.jpg" width="33" height="327" /></td>
        <td width="293" valign="top" background="../images/diary_12.jpg"><table cellspacing="0" cellpadding="0">
            <tr>
              <td width="293" height="21" valign="bottom" background="../images/diary_6.jpg">&nbsp;</td>
            </tr>
            <tr>
              <td width="293" height="11"><img src="../images/diary_10.jpg" width="293" height="11" alt="" /></td>
            </tr>
            <tr>
              <td width="293" height="292" valign="top" background="../images/diary_12.jpg">

<textarea name="content" id="content" cols="34" rows="17" class="diary_bg" onkeydown="igEsc();">    </textarea>

</td>
            </tr>
        </table></td>
        <td width="30" rowspan="2"><img src="../images/diary_7.jpg" width="30" height="350" /></td>
        <td width="293" bgcolor="#FFFFFF"><div align="center"><img src="<%=diarypic%>" id="pic1" width="260" /></div>
        </td>
        <td width="41"><img src="../images/diary_9.jpg" width="41" height="327" /></td>
      </tr>
      <tr>
        <td height="23" colspan="2" background="../images/diary_14.jpg" style="text-align:center;color:#999;"></td>
        <td colspan="2" background="../images/diary_15.jpg">&nbsp;<!--<a href="#" onmouseover="pic(1)">1</a> <a href="#" onmouseover="pic(2)">2</a> <a href="#" onmouseover="pic(3)">3</a> <a href="#" onmouseover="pic(4)">4</a> <a href="#" onmouseover="pic(5)">5</a> <a href="#" onmouseover="pic(6)">6</a> <a href="#" onmouseover="pic(7)">7</a> <a href="#" onmouseover="pic(8)">8</a> <a href="#" onmouseover="pic(9)">9</a> <a href="#" onmouseover="pic(10)">10</a>--></td>
      </tr>
      <tr>
        <td height="34" colspan="5"><img src="../images/diary_16.jpg" width="690" height="34" /></td>
      </tr>
    </table>
<input type="submit" style="font-size:14px;color:#009900;" value=" 提 交 " onClick="return check()" class="button"> 按住Ctrl+Enter可以提交
                 </td>
            </tr>
		  </form>
        </table>

<%End If%>    

<%
  conn.close()
  set conn =nothing
%>
</body>
</html>

<!--
<script type="text/javascript">
    function pic(obj) {
        document.getElementById("pic1").src = 'http://user.jizhangla.com/diary/bg/a_' + obj + '.jpg';
        document.getElementById("pic1").alt = obj;
    }
    function SubmitData() {
    var _title = $("#txlTit").val();
    var _memo = $("#txlMemo").val();
    var _dt = $("#currentDt").val();
    var _passed = $("input[@name=passed]:checked").val();
    var _pic = document.getElementById('pic1').alt;
    var _json = { "title": _title, "memo": _memo, "dt": _dt, "passed": _passed, "pic": _pic };
    $.ajax({
        type: "POST",
        dataType: "html",
        url: "add.aspx?action=Add",
        data: _json,
        success: function(result) {
            if (result == "ok") {
                alert("操作成功!返回日记列表");
                window.location.href = 'index.aspx';
            }
            else
                ymPrompt.alert(result);
        }
    });
}
function igEsc() {
    if (window.event && window.event.keyCode == 27) {
        window.event.returnValue = false;
    }
}
function copytext() {
    var text1 = $("textarea").html();
    window.clipboardData.setData("Text", text1);
}
window.setInterval("copytext()", 60000);
</script>
-->